'use strict';
module.exports = app => {
  const { DECIMAL, INTEGER, TINYINT, CHAR, TEXT } = app.Sequelize;

  const Order = app.model.define('mall_order', {
    user_id: {//
      type: INTEGER,
      allowNull: false,
      comment: '用户id',
    },
    address_id: {
      type: INTEGER,
      allowNull: false,
      comment: '地址id',
    },
    shop_id: {
      type: INTEGER,
      allowNull: false,
      comment: '商铺id',
    },
    goods_id: {
      type: TEXT,
      allowNull: false,
      comment: '商品id',
    },
    total: {
      type: DECIMAL(10, 2),
      allowNull: false,
      comment: '订单总金额',
    },
    order_number: {
      type: CHAR(35),
      unique: true,
      allowNull: false,
      comment: '唯一订单号',
    },
    // order_number: {
    //   type: CHAR(13),
    //   unique: true,
    //   allowNull: false,
    //   comment: '唯一订单号',
    // },
    status: {
      type: TINYINT,
      allowNull: false,
      defaultValue: 0,
      comment: '订单状态(0:未支付，1已支付，2已发货，3已签收，4取消)',
    },

  });

  return Order;
};
